<template>
  <div class="nav-menu">
    <div class="nav-tit">
      <dv-decoration-7 style="width:280px;height:30px;">每日设计</dv-decoration-7>
    </div>
    <el-menu
      default-active="1"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
    >
      <el-menu-item index="1">
        <i class="el-icon-s-home"></i>
        <span slot="title" @click="$router.push({path:'/'})">首页</span>
      </el-menu-item>
      <el-submenu index="2">
        <template slot="title">
          <i class="el-icon-reading"></i>
          <span>文章管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="2-1" @click="$router.push({path:'/artical/articalList'})">文章列表</el-menu-item>
          <el-menu-item index="2-2" @click="$router.push({path:'/artical/signList'})">标签列表</el-menu-item>
          <el-menu-item index="2-3" @click="$router.push({path:'/artical/commentList'})">评论列表</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index="3">
        <template slot="title">
          <i class="el-icon-user"></i>
          <span slot="title">用户管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="3-1" @click="$router.push({path:'/user/userList'})">用户列表</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index="4">
        <template slot="title">
          <i class="el-icon-data-board"></i>
          <span slot="title">广告管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="4-1" @click="$router.push({path:'/advert/adList'})">广告列表</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <!-- <el-submenu index="5">
            <template slot="title">
              <i class="el-icon-present"></i>
              <span slot="title">产品管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="5-1">产品列表</el-menu-item>
            </el-menu-item-group>
      </el-submenu>-->
      <!-- <el-submenu index="6">
            <template slot="title">
              <i class="el-icon-search"></i>
              <span slot="title">搜索管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="6-1">热门词推荐</el-menu-item>
            </el-menu-item-group>
      </el-submenu>-->
      <el-submenu index="7">
        <template slot="title">
          <i class="el-icon-coffee-cup"></i>
          <span slot="title">问答管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="7-1" @click="$router.push({path:'/answer/answerList'})">问答列表</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <!-- <el-submenu index="8">
            <template slot="title">
              <i class="el-icon-setting"></i>
              <span slot="title">系统管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="8-1">目录树管理</el-menu-item>
              <el-menu-item index="8-2">栏目介绍维护</el-menu-item>
              <el-menu-item index="8-3">内容管理</el-menu-item>
            </el-menu-item-group>
      </el-submenu>-->
    </el-menu>
  </div>
</template>
<script>
export default {
  name: "navMenu",
  data() {
    return {
      path: "",
    };
  },
  watch: {
    $route(to, from) {
      this.path = to.path;
    },
  },
  methods:{
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
  created() {
    let vm = this;
    this.path = this.$route.path;
  },
};
</script>